<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="">
        <input type="checkbox" name="check" id="">同意并接受用户协议
        <br>
        <button>提交</button>
    </form>
    <script>
        var form = document.querySelector('form');
        var check = form.elements['check'];
        var btn = document.querySelector('button');
        btn.onclick = function () {
            //如果
            if (check.checked == true) {
                console.log(check.checked);
                alert("提交成功")
            } else {
                console.log(check.checked);
                alert("不同意协议，我们将无法为您提供服务")
            }
        }
    </script>
</body>

</html>